package LCR剑指.LCR080;

import java.util.ArrayList;
import java.util.List;

class Solution {

    private static List<List<Integer>> res = new ArrayList<>();

    public static List<List<Integer>> combine(int n, int k) {
        dfs(n, k, 1, new ArrayList<>());
        return res;
    }

    private static void dfs(int n,int k,int cur,List<Integer> curList){
        if(curList.size()==k){
            List<Integer> list = new ArrayList<>(curList);
            res.add(list);
            return;
        }
        if(curList.size()+n-cur+1<k){
            return;
        }
        curList.add(cur);
        dfs(n,k,cur+1,curList);
        curList.remove(curList.size()-1);
        dfs(n,k,cur+1,curList);
    }

    public static void main(String[] args) {
        combine(1, 1);
    }
}